Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int f(int t[], int rozmiar)
- {
- int suma=0, i;
- for (i=0; i<rozmiar; i++)
- {
- if (t[i]<0) suma+=t[i];
- }
- return suma;
- }
- int main(void)
- {
- int tab[1000];
- int ilosc;
- int i;
- printf("Podaj ilosc liczb: ");
- scanf("%d", &ilosc);
- printf ("Podaj te liczby: ");
- for(i=0; i<=ilosc-1; i++)
- scanf("%d", &tab[i]);
- printf("Wynik: %d", f(tab, ilosc));
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment